package com.app.teaware.util;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.IntentFilter;

import com.app.teaware.basis.Constants;

public  class ReceiverUtils {

    public static void registerUHFAndScannerReceiver(Context mContext, BroadcastReceiver mResultReceiver) {
        try {
            mContext.registerReceiver(mResultReceiver, new IntentFilter(Constants.ACTION_UHF_RESULT_SEND));    //rfid读卡通知
            mContext.registerReceiver(mResultReceiver,new IntentFilter(Constants.ACTION_SCANNER_RESULT_SEND));           //扫描结果通知
        } catch (Exception e) {
            e.printStackTrace();
        }

    }


    public static void registerUHFReceiver(Context mContext, BroadcastReceiver mResultReceiver) {
        try {
            mContext.registerReceiver(mResultReceiver, new IntentFilter(Constants.ACTION_UHF_RESULT_SEND));    //rfid读卡通知
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


    public static void registerScannerReceiver(Context mContext, BroadcastReceiver mResultReceiver) {
        try {
            mContext.registerReceiver(mResultReceiver,new IntentFilter(Constants.ACTION_SCANNER_RESULT_SEND));           //扫描结果通知
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


    public static void unRegisterReceiver(Context mContext, BroadcastReceiver mResultReceiver) {
        try {
            mContext.unregisterReceiver(mResultReceiver);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
